"""
2.用户输入一个数字，判断一个数是否是水仙花数。
水仙花数是一个三位数, 三位数的每一位的三次方的和还等于这个数.
那这个数就是一个水仙花数, 例如: 153 = 1**3 + 5**3 + 3**3
"""
# s_num = input("请输入一个三位数:")
# num_sum = 0
# if s_num.isdecimal():
#     for i in s_num:
#         num_sum += int(i) ** 3
#     if int(s_num) == num_sum:
#         print("水仙花")
#     else:
#         print("不是水仙花")

# s_num = input("请输入一个三位数:")
# num_sum = 0
# if s_num.isdecimal():
#     for i in s_num:
#         num_sum += int(i) ** 3
#     a = "水仙花" if int(s_num) == num_sum else "不是水仙花"
#     print(a)

# s = "老衲"
# print(s[::-1])
#
# l1 = [1, 3, 6, 7, 9, 8, 5, 4, 2]
# print(l1[::-1])

# l1.sort(reverse=True)
# print(l1)
#
# l1.sort()
# print(l1)
#
# l1.reverse()
# print(l1)

"""
6.完成彩票36选7的功能. 从36个数中随机的产生7个数. 
最终获取到7个不重复的数据作为最终的开奖结果.
随机数:

randint(0, 20) # 0 - 20 的随机数
"""
# 7
# s = set()  # {12,23,2,3,11,33,55}
# from random import randint
# while len(s) != 7:
#     s.add(randint(1,36))
# print(s)

# s1 = '太白金星'
# # 将s1转换成utf-8的bytes类型。
# print(s1.encode("utf-8"))
# # 将s1转化成gbk的bytes类型。
# print(s1.encode("gbk"))
#
# b = b'\xe5\xae\x9d\xe5\x85\x83\xe6\x9c\x80\xe5\xb8\x85'
# # b为utf-8的bytes类型，请转换成gbk的bytes类型。
# b1 = b.decode("utf-8")
# print(b1.encode("gbk"))

"""
8.把列表中所有姓周的⼈的信息删掉(升级题：此题有坑, 请慎重):
lst = ['周⽼⼆', '周星星', '麻花藤', '周扒⽪']
结果: lst = ['麻花藤']
"""
# lst = ['周⽼⼆', '周星星', '麻花藤', '周扒⽪']
#
# for i in range(len(lst)-1,-1,-1):
#     if "周" in lst[i]:
#         lst.pop(i)
# print(lst)

"""
9.⻋牌区域划分, 现给出以下⻋牌. 根据⻋牌的信息, 分析出各省的⻋牌持有量. (升级题)
cars = ['鲁A32444','鲁B12333','京B8989M','⿊C49678','⿊C46555','沪 B25041'.....]
locals = {'沪':'上海', '⿊':'⿊⻰江', '鲁':'东', '鄂':'湖北', '湘':'湖南','京':'北京'}
"""
cars = ['鲁A32444','鲁B12333','京B8989M','黑C49678','黑C46555','沪B25041']
locals = {'沪':'上海', '黑':'黑龙江', '鲁':'山东', '鄂':'湖北', '湘':'湖南',"京":"北京"}
# 结果:{"山东":2,"北京":1,"黑龙江":2,"上海":1}

# dic = {}  # {"山东":1}
# for i in cars:
#     # i[0] 鲁
#     # locals["鲁"]  山东
#     # dic["键"] = "值"
#     # dic["山东"] = 2
#     # locals[i[0]]  山东
#     # dic.get("哈尔滨")  # None
#     # dic.get("哈尔滨",0)  # 0
#     # dic.get("山东",0) + 1 # 0
#     dic[locals[i[0]]] = dic.get(locals[i[0]],0) + 1
# print(dic)

"""
10.⼲掉主播. 现有如下主播收益信息:
 1. 计算主播平均收益值
 2. 干掉收益低于平均值的主播 
 3. 干掉闫龙
"""
# zhubo = {'景女神': 12, '闫龙': 18, '金老板': 9, '吴老板': 2, 'alex': 0.5}
# num_sum = 0
# for i in zhubo.values():
#     num_sum += i
# avg = num_sum / len(zhubo)
#
# li = []
# for k,v in zhubo.items():
#     if avg > v:
#         li.append(k)
# for em in li:
#     zhubo.pop(em)
# print(zhubo)
#
# zhubo.pop('闫龙')
# print(zhubo)